﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DAL.Repositories
{
    public class CinemaRepository : RepositoryInterfaces.ICinemaRepository
    {
        /// <summary>
        /// Gets all Cinemas
        /// </summary>
        /// <returns>All Cinemas</returns>
        /// <exception cref="ArgumentNullException">If no Cinemas exists</exception>
        /// <exception cref="Exception"></exception>
        public IList<Cinema> GetCinemas()
        {
            try
            {
                using (BalderEntities _db = new BalderEntities())
                {
                    return _db.Cinemas.ToList();
                }
            }
            catch (ArgumentNullException e)
            {
                throw new ArgumentNullException("No Cinemas exists" + Environment.NewLine + e.Message);
            }
            catch (Exception)
            {
                throw;
            }
        }
    }
}